﻿using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Text;
using System.Threading.Tasks;

namespace Hello_Word
{
    class Program
    {
        
        static void Main(string[] args)
        {
            #region //简单计算器
            /*   int num1, num2, result;
               Console.WriteLine("请输入数字a");
               //读取键盘输入
               num1=int.Parse(Console.ReadLine());
               Console.WriteLine("请输入数字b");
               //读取键盘输入
               num2 = int.Parse(Console.ReadLine());
               result = num1 + num2;
               Console.WriteLine("A因子:{0},B因子:{1}", num1, num2); 
               // Console.WriteLine("结果是{0}", result);
               //Console.WriteLine($"结果是{result}");
              */
            #endregion
            #region //数据类型占内存大小
            /*  char c = '中';
                 Console.WriteLine("char占{0}字节", sizeof(char));
                 Console.WriteLine("char最大值是{0}", (int)char.MaxValue);
                 Console.WriteLine(c);

             #endregion
             #region //if语句
             float price = 100;
             bool isVIP = true;
             string country = "中国";
             if (country == "中国")
             {
                 if (isVIP)
                     price *= 0.5f;
                 else
                     price *= 0.8f;
             }
             else
             {
                 if (isVIP)
                     price *= 0.7f;
                 else
                     price *= 0.98f;
             }
             Console.WriteLine("price{0}",price);
            */
            #endregion
            #region //一年中的第几天
          /*  Console.WriteLine("请输入年/月/日");
             string str = Console.ReadLine();
             //拆分字符串
             char[] separtor= { '/' };
             string[] strArr = str.Split(separtor);

             int year = int.Parse(strArr[0]);  //年
             int month = int.Parse(strArr[1]); //月
             int day = int.Parse(strArr[2]);   //日
             int sum = 0;
             //Console.WriteLine(strArr[0]);
             //Console.WriteLine(strArr[1]);
             //Console.WriteLine(strArr[2]);
             switch (month-1)
             {
                 case 0:
                     sum = day;
                     break;
                 case 1:
                     sum = 31+day;
                     break;
                 case 2:
                     sum = 31 + 28+day;
                     break;
                 case 3:
                     sum = 31 + 28 + 31;
                     break;
                 default:
                     Console.WriteLine("默认处理方式，可选");
                     break;
             }
             //判断闰年
             if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
             {
                 sum += 1;
                 Console.WriteLine("是闰年");
             }

                 Console.WriteLine("这是一年中的第{0}天",sum);
            */
            #endregion
            #region //声明方式1
            //访问方式1
            /* int size =12;
            int[] a=new int [size];
            for (int i = 0; i < a.Length; i++)
            {
                a[i] = i * 10;
               // Console.WriteLine(a[0]);
            }
            //访问方式2(只读遍历)
            foreach (int num in a)
            {
                Console.WriteLine(num);
            }*/
            #endregion
            #region //声明方式2
          int[] b = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };  
            Console.WriteLine("请输入年/月/日");
            string str = Console.ReadLine();
            //拆分字符串
            char[] separtor = { '/' };
             string[] strArr = str.Split(separtor);
             int year = int.Parse(strArr[0]);  //年
             int month = int.Parse(strArr[1]); //月
             int day = int.Parse(strArr[2]);   //日
             int sum = 0;
             for (int i = 1; i < month; i++)
             {
                 sum += b[i];
             }
             sum += day;
             Console.WriteLine($"这是一年中的第{sum}天");
            
            #endregion
            #region  //二维数组
            /*  int[,] c = { {4,9,2},{3,5,7},{8,1,6} };
                for (int i = 0; i < 3; i++)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        Console.WriteLine(c[i,j]+"");
                    }
                    Console.WriteLine ();
                } 
            */
            #endregion

        }
    }
}

